home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Composite.ieb 1.2, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 24/1 1997 Stockholm/Sweden ** ** Composite two images into one with with various mix-functions. ** Use separate batch scripts for "Alpha" and "Mix" functions. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK S2' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Xoff=0 ; Yoff=0 if command ~= '' then parse var command Xoff Yoff '#'CFunk 'IE_TO_FRONT' form = 'FORM "Composite" " OK | Cancel"', ' INTEGER,"X offset",-4096,4096,'Xoff',SLIDER', ' INTEGER,"Y offset",-4096,4096,'Yoff',SLIDER' if command = '' then do form = form||' CYCLE,"Composite method","Add|Difference|Max|Min|Multiply|Subtract",0' form parse var result ok Xoff Yoff CFunk if ok = 0 then return '<ERROR>' select when CFunk = 0 then CFunk = 'ADD' when CFunk = 1 then CFunk = 'DIFFERENCE' when CFunk = 2 then CFunk = 'MAX' when CFunk = 3 then CFunk = 'MIN' when CFunk = 4 then CFunk = 'MULTIPLY' when CFunk = 5 then CFunk = 'SUBTRACT' end end else do form parse var result ok Xoff Yoff if ok = 0 then return '<ERROR>' CFunk = 'none' end back = Xoff Yoff '#'CFunk return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' '"'sec_image'"' parse var options Xoff Yoff '#'CFunk 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = Result if (strip(upper(src_image)) = strip(upper(sec_image))) then use_same = 1 if use_same ~= 1 then do 'OPEN' '"'sec_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||sec_image'"' '" OK "' return '<ERROR>' end else SecondImage = Result end else SecondImage = LoadImage 'PROJECT_INFO' LoadImage 'WIDTH' IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' IH = RESULT 'PROJECT_INFO' SecondImage 'WIDTH' SIW = RESULT 'PROJECT_INFO' SecondImage 'HEIGHT' SIH = RESULT if Xoff > SIW then Xoff = SIW if Yoff > SIH then Yoff = SIH if Xoff < (-1)*IW then Xoff = (-1)*IW if Yoff < (-1)*IH then Hoff = (-1)*IH 'MARK' LoadImage 'PRIMARY' 'MARK' SecondImage 'SECONDARY' 'COMPOSITE' Xoff Yoff CFunk OutputImage = result 'CLOSE' LoadImage if use_same ~= 1 then 'CLOSE' SecondImage if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'